<?php

namespace app\controllers;

use app\config\Constants;
use app\utils\QueueUtil;
use yii\web\Controller;

class SiteController extends Controller
{
    /**
     * {@inheritdoc}
     */
    public function actions()
    {
        return [
            'error' => [
                'class' => 'yii\web\ErrorAction',
            ],
        ];
    }

    /**
     * Displays homepage.
     *
     * @return string
     */
    public function actionIndex()
    {
        return "welcome";
    }

    //心跳
    public function actionPing(){
        QueueUtil::fanout(Constants::MSG_TYPE_ORDER,Constants::ORDER_WAIT,['order_no'=>"123456"]);
        QueueUtil::fanout(Constants::MSG_TYPE_ORDER,Constants::ORDER_ACCEPT,['order_no'=>"123456"]);
        QueueUtil::fanout(Constants::MSG_TYPE_ORDER,Constants::ORDER_CANCEL,['order_no'=>"123456"]);
    }
}
